#include "interface/login.h"
#include <QtGui/QApplication>

//#include "gps/cusergps.h"

#include "socket/csocketcommunication.h"

#include "mainwindow.h"
#include "interface/login.h"

// client infomation
DRIVER_NAME g_driverInfo;

// a define that instrict the length of characters used in protocols.
const int CHARACTERLENGTH = 10;

// the chosen car infomation
CHOSEN_CLIENT_INFO g_chosenClient;

// the order info
ORDER_INFO g_orderInfo;


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

//    // initialize the GPS function
//    if (!CUserGPS::InitializeInstance())
//    {
//        return 0;
//    }

//    // update every 3 seconds
//    CUserGPS::GetInstance()->setUpdateInterval(3000);

    // support for map relative web view
    app.setApplicationName(QString("Chrome"));
    app.setApplicationVersion(QString("1.0"));

    // TODO: read config file to get the configuration

    // initialize the socket engine
    CSocketCommunication::InitInstance();

    // set Ip and port
    CSocketCommunication::setIpAndPort(QString("127.0.0.1"), 6178);

    // connect to server, not until the user exits the system will we close the connection
    CSocketCommunication::GetInstance()->connectToServer();

    // open the login interface
    CMainWindow mainWindow(new interface::CLoginInterface());

    // show out the interface
    mainWindow.show();

    return app.exec();
}
